package com.itheima.common;

import org.springframework.stereotype.Component;

/**
 * 基于threadlocal封装工具类，保存和获取登入用户id
 * threadLocal线程  用于MyMetaObjecthandler类中 中保存employee.id
 */

public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }
}
